#include "myimageprovider.h"
#include <QDebug>

MyImageProvider::MyImageProvider()
    : QQuickImageProvider(QQuickImageProvider::Image)
{

}

void MyImageProvider::setCameraInstance(opencv_camera *camera)
{
    this->m_camera = camera;
}
// 被绑定的路径名所触发的回调函数  id:标识
QImage MyImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
//    qDebug() << id;
//    return this->m_camera->getCameraImage();
    QImage img;

    if(id == "check_face") {
        img = *this->m_camera->getCheckFaceImg();
    } else {
        img = this->m_camera->getCameraImage_face();
    }

    return img;
}



